All Questions
Tagged with arraymemory-management
37 questions
1vote
0answers
67views
Presence of UB and memory usage of a std::array initialization: version with temporary array on heap
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539. A classical way to answer would be to use std::index_sequence-based ...
3votes
1answer
240views
Presence of UB and memory usage of a std::array initialization
I proposed several techniques to answer to https://stackoverflow.com/q/78672409/21691539. A classical way to answer would be to use std::index_sequence-based ...
2votes
0answers
53views
Reusable storage for array of objects V4
Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers. The ...
1vote
1answer
55views
Reusable storage for array of objects V3
Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers. The following code should be compliant at ...
3votes
1answer
72views
Reusable storage for array of objects V2
Here is a follow up on Reusable storage for array of objects, taking into account the provided answers. The following code should be compliant at least with gcc, <...
4votes
2answers
509views
Reusable storage for array of objects
My goal is to have a memory pool non-template class that is used to store arrays of objects. The same memory pool object must be reusable for a different array (difference size, different type and/or ...
10votes
5answers
3kviews
Implementation of a two-dimensional array in C
I implemented a two-dimensional array in C and would like to know if the implementation is sound in terms of Memory management Potential bugs and other side effects that I missed Code style (...
6votes
3answers
2kviews
Dynamic array implementation using C++
I implemented a basic dynamic array using C++. When deleting an element and shifting the others, the last element will be twice repeated (the original still exists after copying). I want to avoid ...
1vote
1answer
759views
dynarr - yet another simple C dynamic array library
I wrote my own dynamic array library for C as I was not happy with the others I found. It is very crude but the basic logic should be correct, it mainly revolves making ...
3votes
1answer
164views
Smart/Dynamic array in C
I attempted to make a smart/dynamic array implementation in C which is supposed to be a hybrid between a C++ vector/stack/queue. This is what i came up with: Header (smart_array.h): ...
5votes
3answers
140views
Removing unneeded objects from an array before rendering
I'm making a function that adds a new object to an array and removes the oldest if it has reached a specific length. Click the button in the example below. All objects are drawn until its array ...
2votes
1answer
143views
A heap-allocated texture class for a console renderer
I am working on a console renderer and I want a heap-allocated dynamic texture class. Since I am quite new to C++, I just want to check the memory management, if I destroy all pointers correctly etc. ...
8votes
1answer
862views
A fixed-size dynamic array
Background I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
5votes
2answers
1kviews
A static array implementation in C++
I'm implementing a basic array data structure with basic functionalities. ...
1vote
1answer
48views
Dynamically-resizable array implementation, for use in a game-dev-related library
I've been working on a library that includes a list-like structure, which I use internally multiple times to store different types of structs. However, I'm not entirely confident with my ability to ...